import { createRouter, createWebHashHistory } from 'vue-router'
// 4.2进行Login/Layout导入配置
import Login from '@/views/login'
import Layout from '@/views/layout'
import Category from '@/views/category' // 4.4进行导入
import Home from '@/views/home' // 4.5进行导入
import Good from '@/views/good'
import Cart from '@/views/cart'// 列表购物车
import Settlement from '@/views/settlement'
import Pay from '@/views/pay'
import Back from '@/views/pay/back.vue'
const routes = [
  {
    path: '/', // 跳转路径
    component: Layout,
    children: [
      // 4.5进行配置
      {
        path: '', // 置空将作为默认的二级路由显示
        component: Home
      },
      // 4.4进行配置
      {
        path: 'category/:id', // 跳转路径
        component: Category
      },
      // 17.2商品路由
      {
        path: '/good/:id',
        component: Good

      }, {
        path: '/cart',
        component: Cart
      }, {
        path: '/settlement',
        component: Settlement
      },
      // 支付页面==携带id
      {
        path: '/pay',
        component: Pay
      },
      {
        path: 'pay/callback',
        component: Back
      }]

  },
  {
    path: '/login', // 跳转路径
    component: Login

  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
